package com.atguigu.udmp.stream.common.test.groovy;

import com.atguigu.udmp.stream.common.util.GroovyUtil;

public class NumLikeMainGvy {



    public static void main(String[] args) throws Exception {
        String sourceCode="package com.atguigu.udmp.stream.common.test.groovy;\n" +
                "\n" +
                "public class Num3LikeExtractor  implements  NumLikeExtractor{\n" +
                "\n" +
                "    @Override\n" +
                "    public boolean ifLike(Integer num) {\n" +
                "        if(num%3==0){\n" +
                "            return true;\n" +
                "        }\n" +
                "        return false;\n" +
                "    }\n" +
                "}\n";

        NumLikeExtractor numLikeExtractor = GroovyUtil.parseGroovyToObject(sourceCode,NumLikeExtractor.class)  ;
        for (int i = 0; i < 100; i++) {
            if(numLikeExtractor.ifLike(i)){
                System.out.println("i like   " + i);
            }
        }
    }
}
